let mainPostId;

window.onload = function init(){
    initMainPost();
    mainPostId=getQuery("mainPostID")
}

function initMainPost(){
    axios.get("mainPost/findById",{params:{mainPostId}}).then(resp=>{
        $("sendUserName").innerHTML=resp.data.userBean.userName;
        $("sendUserDate").innerHTML=resp.data.userBean.joinDate;
        $("mainPostTitle").innerHTML=resp.data.title;
        $("mainPostContent").innerHTML=resp.data.content;
        $("sendUserImg").src=`/productImg/${resp.data.userBean.imgPath}`
    })
}
function addReply(){
    axios.get("reply/add",{
        params:{
            title:$("title").value,
            content:$("content").value,
            mainPostId
        }
    }).then(resp=>{
        if (resp.data == "ok"){
            location.href="/mainPost.html"
        }
    })
}